# 生成1000以内的斐波那契数列
a = 0
b = 1
while b < 1000:
    print(b)
    a, b = b, a + b
print()


# 定义一个函数,返回n个斐波那契数列
def fibs(n):
    res = [1, 1]
    for i in range(n - 2):
        res.append(res[-2] + res[-1])
    return res
res=fibs(20)
print(res)


# 生成某个斐波那契数列
# def fibs(n):
#     return 1 if n<3 else fibs(n-1)+fibs(n-2)
# print(fibs(20))


